package com.netmi.myjectpack.paging

import androidx.paging.Pager
import androidx.paging.PagingConfig
import androidx.paging.PagingData
import com.netmi.myjectpack.paging.bean.RepoBean
import kotlinx.coroutines.flow.Flow

/**
 * @author tgw
 * @date 2021/4/29
 * @describe
 */
object Repository {

    private const val PAGE_SIZE = 50

    private val gitHubService = GitHubService.create()

    fun getPagingData(): Flow<PagingData<RepoBean>> {
        return Pager(
                config = PagingConfig(0),
                pagingSourceFactory = { RepoPagingSource(gitHubService) }
        ).flow
    }

}